Index: typo3/class.db_list_extra.inc =================================================================== --- typo3/class.db_list_extra.inc (revision 4805) +++ typo3/class.db_list_extra.inc (working copy) @@ -383,7 +383,17 @@ $this->iLimit = 0; } - $queryParts = $this->makeQueryArray($table, $id,$addWhere,$selFieldList); // (API function from class.db_list.inc) + if ($this->firstElementNumber > 2 && $this->iLimit > 0) { + // Get the two previous rows for sorting if displaying page > 1 + $this->firstElementNumber = $this->firstElementNumber - 2; + $this->iLimit = $this->iLimit + 2; + $queryParts = $this->makeQueryArray($table, $id,$addWhere,$selFieldList); // (API function from class.db_list.inc) + $this->firstElementNumber = $this->firstElementNumber + 2; + $this->iLimit = $this->iLimit - 2; + } else { + $queryParts = $this->makeQueryArray($table, $id,$addWhere,$selFieldList); // (API function from class.db_list.inc) + } + $this->setTotalItems($queryParts); // Finding the total amount of records on the page (API function from class.db_list.inc) // Init: @@ -460,6 +470,15 @@ $prevUid = 0; $prevPrevUid = 0; + + // Get first two rows and initialize prevPrevUid and prevUid if on page > 1 + if ($this->firstElementNumber > 2 && $this->iLimit > 0) { + $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); + $prevPrevUid = -(int)$row['uid']; + $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); + $prevUid = $row['uid']; + } + $accRows = array(); // Accumulate rows here while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { @@ -1574,4 +1593,4 @@ include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.db_list_extra.inc']); } -?> \ No newline at end of file +?>