From a17a1935659d66837bc6b45fc78faa4900d7c2be Mon Sep 17 00:00:00 2001 From: Daniel Cannon Date: Tue, 4 Dec 2007 22:14:25 +0000 Subject: [PATCH] Woops, fix bug with last commit when the number of rows <= 2. --- includes/SpecialUndelete.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/includes/SpecialUndelete.php b/includes/SpecialUndelete.php index a49bd7176d..2f88bda2ed 100644 --- a/includes/SpecialUndelete.php +++ b/includes/SpecialUndelete.php @@ -862,13 +862,17 @@ class UndeleteForm { $hasMore = false; if ( $revisions && $revisions->numRows() >= $tmpLimit ) { - $revisions->seek ( $revisions->numRows() - 2 ); - $tmp = $revisions->fetchObject(); - $revisions->rewind ( ); + if ( $revisions->numRows() >= 2 ) { + $revisions->seek ( $revisions->numRows() - 2 ); + $tmp = $revisions->fetchObject(); + $revisions->rewind ( ); + $offset = $tmp->ar_timestamp; + } else + $offset = 0; $titleObj = SpecialPage::getTitleFor ( 'Undelete' ); $tmplink = $sk->makeKnownLinkObj ( $titleObj, wfMsg( 'undelete-next-revs', 5000 ), - "target={$this->mTarget}&limit=5000&offset={$tmp->ar_timestamp}" ); + "target={$this->mTarget}&limit=5000&offset=$offset" ); $wgOut->addHTML ( wfMsg ( 'undelete-more-revs', $tmpLimit - 1, $tmplink ) ); $hasMore = true; -- 2.20.1