From d4c121cb573497ba6f465a0bc7215239a4e2e26f Mon Sep 17 00:00:00 2001 From: Rob Church Date: Thu, 25 May 2006 08:22:32 +0000 Subject: [PATCH] (bug 6062) Logic error in {{BASEPAGENAME}} --- includes/Title.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/includes/Title.php b/includes/Title.php index b8769a2fab..1e87fd8a8d 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -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(); -- 2.20.1