/** * @param QueryWrapperInterface $query * @return QueryWrapperInterface */ public function applyToQuery(QueryWrapperInterface $query) { $maxPerPage = $this->getCriterion(); $page = $this->getControl(); return $query->offset(($page - 1) * $maxPerPage)->limit($maxPerPage); }