(bug 39429) Fix wrong counting on query pages [regression]
authorumherirrender <umherirrender_de.wp@web.de>
Thu, 16 Aug 2012 15:40:28 +0000 (17:40 +0200)
committerumherirrender <umherirrender_de.wp@web.de>
Thu, 16 Aug 2012 15:40:28 +0000 (17:40 +0200)
Change-Id: I1c5be7cd6b3dd0990dba8f30f9d859aa841a1f55

includes/QueryPage.php

index 076b1b5..e188d3b 100644 (file)
@@ -526,7 +526,8 @@ abstract class QueryPage extends SpecialPage {
                        $out->addHTML( $this->getPageHeader() );
                        if ( $this->numRows > 0 ) {
                                $out->addHTML( $this->msg( 'showingresults' )->numParams(
-                                       $this->numRows, $this->offset + 1 )->parseAsBlock() );
+                                       min( $this->numRows, $this->limit ), # do not show the one extra row, if exist
+                                       $this->offset + 1 )->parseAsBlock() );
                                # Disable the "next" link when we reach the end
                                $paging = $this->getLanguage()->viewPrevNext( $this->getTitle( $par ), $this->offset,
                                        $this->limit, $this->linkParameters(), ( $this->numRows <= $this->limit ) );
@@ -557,7 +558,7 @@ abstract class QueryPage extends SpecialPage {
 
                $out->addHTML( Xml::closeElement( 'div' ) );
 
-               return $this->numRows;
+               return min( $this->numRows, $this->limit ); # do not return the one extra row, if exist
        }
 
        /**