public function getPages()
    {
        if ($this->getPageRange() > $this->getPagesCount()) {
            $this->setPageRange($this->getPagesCount());
        }

        $delta = ceil($this->getPageRange() / 2);

        if ($this->getCurrentPageNumber() - $delta > $this->getPagesCount() - $this->getPageRange()) {
            $pages = range($this->getPagesCount() - $this->getPageRange() + 1, $this->getPagesCount());
        } else {
            if ($this->getCurrentPageNumber() - $delta < 0) {
                $delta = $this->getCurrentPageNumber();
            }

            $offset = $this->getCurrentPageNumber() - $delta;
            $pages = range($offset + 1, $offset + $this->getPageRange());
        }

        return $pages;
    }