/** * Forgery constructor * * @param \Magelight\Db\Collection $collection - collection to build pager for */ public function __forge(\Magelight\Db\Collection $collection = null) { $this->collection = $collection; $this->addClass('pagination'); if ($this->collection instanceof \Magelight\Db\Collection) { $this->setTotal($this->collection->totalCount()); $this->setPerPage($this->collection->getLimit()); $this->setCurrentPage($this->perPage ? floor($this->collection->getOffset() / $this->perPage) : 1); } $this->setNextCaption()->setPrevCaption()->setFirstCaption()->setLastCaption(); }