/** * Sets the page length, page start and total items from a query object's * limit, offset and unlimited count. The query MUST have a limit clause. * * @param SQLSelect $query * @return $this */ public function setPaginationFromQuery(SQLSelect $query) { if ($limit = $query->getLimit()) { $this->setPageLength($limit['limit']); $this->setPageStart($limit['start']); $this->setTotalItems($query->unlimitedRowCount()); } return $this; }