From 4609ffd0b2ea42488c0924f1fd730b6cc66a0f7f Mon Sep 17 00:00:00 2001
From: Brion Vibber
Date: Sun, 26 Jun 2005 20:05:56 +0000
Subject: [PATCH] * Fix paging on Special:Contributions
---
RELEASE-NOTES | 1 +
includes/SpecialContributions.php | 13 +++++++++----
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/RELEASE-NOTES b/RELEASE-NOTES
index ca394468f4..ffaa3a50fc 100644
--- a/RELEASE-NOTES
+++ b/RELEASE-NOTES
@@ -370,6 +370,7 @@ Various bugfixes, small features, and a few experimental things:
* Conversion fix for empty old table in upgrade1_5.php
* Try reading revisions from master if no result on slave
* (bug 2538) Suppress notice on user serialized checks
+* Fix paging on Special:Contributions
=== Caveats ===
diff --git a/includes/SpecialContributions.php b/includes/SpecialContributions.php
index e4e4840613..1750b4d959 100644
--- a/includes/SpecialContributions.php
+++ b/includes/SpecialContributions.php
@@ -29,8 +29,7 @@ function wfSpecialContributions( $par = null ) {
# FIXME: Change from numeric offsets to date offsets
list( $limit, $offset ) = wfCheckLimits( 50, '' );
- $offlimit = $limit + $offset;
- $querylimit = $offlimit + 1;
+ $querylimit = $limit + 1;
$sk = $wgUser->getSkin();
$dbr =& wfGetDB( DB_SLAVE );
$userCond = "";
@@ -99,7 +98,7 @@ function wfSpecialContributions( $par = null ) {
rev_deleted
FROM $page,$revision $use_index
WHERE page_id=rev_page AND $condition $minorQuery " .
- "ORDER BY rev_timestamp DESC LIMIT {$querylimit}";
+ "ORDER BY rev_timestamp DESC " . $dbr->limitResult( $querylimit, $offset );
$res = $dbr->query( $sql, $fname );
$numRows = $dbr->numRows( $res );
@@ -111,7 +110,7 @@ function wfSpecialContributions( $par = null ) {
$sl = wfViewPrevNext( $offset, $limit,
$wgContLang->specialpage( "Contributions" ),
"hideminor={$hideminor}&namespace={$namespace}&target=" . wfUrlEncode( $target ),
- ($numRows) <= $offlimit);
+ ($numRows) <= $limit);
$shm = wfMsg( "showhideminor", $mlink );
$wgOut->addHTML( "
{$sl} ($shm)
\n");
@@ -123,9 +122,15 @@ function wfSpecialContributions( $par = null ) {
}
$wgOut->addHTML( "\n" );
+ $n = 0;
while( $obj = $dbr->fetchObject( $res ) ) {
+ if( ++$n > $limit ) {
+ // Extra row for determining 'next'ability, don't display
+ break;
+ }
$wgOut->addHTML( ucListEdit( $sk, $obj ) );
}
+ $dbr->freeResult( $res );
$wgOut->addHTML( "
\n" );
$wgOut->addHTML( "
{$sl} ($shm)\n");
--
2.20.1