public function getPagesList($length = 10)
    {
         // Pages in range
        $pagenum = $this->getPageNum();
        $pagecount  = $this->getPages();

        if($length > $pagecount) {
            $length = $pagecount;
        }

        $delta = ceil($length / 2);

        if($pagenum <= 1) {
            $lowerbound = 1;
            $upperbound = min($pagecount, $length);
        }
        else if($pagenum - $delta > $pagecount - $length) {
            $lowerbound = $pagecount - $length + 1;
            $upperbound = $pagecount;
        }
        else {
            if ($pagenum - $delta < 0) {
                $delta = $pagenum;
            }

            $offset     = $pagenum - $delta;
            $lowerbound = $offset + 1;
            $upperbound = $offset + $length;
        }

        return range($lowerbound, $upperbound);
    }