public function limit($limit, $offset = null) { $this->limit = (int) $limit; if (null !== $offset) { $this->skip($offset); } return $this; }
private function applyLimits() { if (!$this->cursor) { return; } $currentPage = $this->getCurrentPage(); // get page of rows $this->cursor->limit($this->itemsOnPage)->skip(($currentPage - 1) * $this->itemsOnPage); }