(bug 6062) Logic error in {{BASEPAGENAME}}
authorRob Church <robchurch@users.mediawiki.org>
Thu, 25 May 2006 08:22:32 +0000 (08:22 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Thu, 25 May 2006 08:22:32 +0000 (08:22 +0000)
includes/Title.php

index b8769a2..1e87fd8 100644 (file)
@@ -697,9 +697,11 @@ class Title {
         */
        function getBaseText() {
                global $wgNamespacesWithSubpages;
-               if( isset( $wgNamespacesWithSubpages[ $this->mNamespace] ) && $wgNamespacesWithSubpages[ $this->mNamespace ] ) {
+               if( isset( $wgNamespacesWithSubpages[ $this->mNamespace ] ) && $wgNamespacesWithSubpages[ $this->mNamespace ] ) {
                        $parts = explode( '/', $this->getText() );
-                       unset( $parts[ count( $parts ) - 1 ] );
+                       # Don't discard the real title if there's no subpage involved
+                       if( count( $parts ) > 1 )
+                               unset( $parts[ count( $parts ) - 1 ] );
                        return implode( '/', $parts );
                } else {
                        return $this->getText();