From 1a45345aa89480d0624a8b56f85b56ddadc5e212 Mon Sep 17 00:00:00 2001 From: Ryan Kaldari Date: Sat, 14 Aug 2010 01:57:05 +0000 Subject: [PATCH] fix to handle case of mIndexField including a table prefix --- includes/Pager.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/includes/Pager.php b/includes/Pager.php index a90867c59d..68acc51bf7 100644 --- a/includes/Pager.php +++ b/includes/Pager.php @@ -194,8 +194,11 @@ abstract class IndexPager implements Pager { function extractResultInfo( $offset, $limit, ResultWrapper $res ) { $numRows = $res->numRows(); if ( $numRows ) { + # Remove any table prefix from index field + $indexColumn = end( explode( '.', $this->mIndexField ) ); + $row = $res->fetchRow(); - $firstIndex = $row[$this->mIndexField]; + $firstIndex = $row[$indexColumn]; # Discard the extra result row if there is one if ( $numRows > $this->mLimit && $numRows > 1 ) { @@ -205,7 +208,7 @@ abstract class IndexPager implements Pager { $this->mPastTheEndIndex = $this->mPastTheEndRow->$indexField; $res->seek( $numRows - 2 ); $row = $res->fetchRow(); - $lastIndex = $row[$this->mIndexField]; + $lastIndex = $row[$indexColumn]; } else { $this->mPastTheEndRow = null; # Setting indexes to an empty string means that they will be @@ -215,7 +218,7 @@ abstract class IndexPager implements Pager { $this->mPastTheEndIndex = ''; $res->seek( $numRows - 1 ); $row = $res->fetchRow(); - $lastIndex = $row[$this->mIndexField]; + $lastIndex = $row[$indexColumn]; } } else { $firstIndex = ''; -- 2.20.1