Created
July 1, 2016 13:24
-
-
Save alex7r/44996460ce13587b36520e43a59b915f to your computer and use it in GitHub Desktop.
pagination limitation of MySQL Calc found rows
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php /** | |
* Method to get the starting number of items for the data set. | |
* | |
* @return integer The starting number of items available in the data set. | |
* | |
* @since 12.2 | |
*/ | |
public function getStart() | |
{ | |
$store = $this->getStoreId('getstart'); | |
// Try to load the data from internal storage. | |
if (isset($this->cache[$store])) | |
{ | |
return $this->cache[$store]; | |
} | |
$start = $this->getState('list.start'); | |
$limit = $this->getState('list.limit'); | |
$total = $this->getTotal(); | |
if ($start > $total - $limit) | |
{ | |
$start = max(0, (int) (ceil($total / $limit) - 1) * $limit); | |
} | |
// Add the total to the internal cache. | |
$this->cache[$store] = $start; | |
return $this->cache[$store]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment