src/Util/Paginator.php
public function getPages($current, $items)
    {
        $start = $current - $this->options['offset_page'] > 1 ? $current - $this->options['offset_page'] : 1;
        $end = $current + $this->options['offset_page'] < $items ? $current + $this->options['offset_page'] : $items;

        $pages = [];
        for ($i = $start; $i <= $end; $i++) {
            $pages[] = $i;
        }
        if ($start > 1) {
            $end_min = 1 + $this->options['offset_page'] >= $start ? $start - 1 : 1 + $this->options['offset_page'];
            if ($start - $end_min > 1) {
                array_unshift($pages, null);
            }
            for ($i = $end_min; $i >= 1; $i--) {
                array_unshift($pages, $i);
            }
        }
        if ($items - $end >= 1) {
            if ($items - $this->options['offset_page'] > $end + 1) {
                $pages[] = null;
            }
            $end_max = $items - $this->options['offset_page'] <= $end ? $end + 1 : $items - $this->options['offset_page'];
            for ($i = $end_max; $i <= $items; $i++) {
                $pages[] = $i;
            }
        }

        return $pages;
    }
public function getPages($current, $items)
    {
        $start = $current - $this->options['offset_page'] > 1 ? $current - $this->options['offset_page'] : 1;
        $end = $current + $this->options['offset_page'] < $items ? $current + $this->options['offset_page'] : $items;

        $pages = [];
        for ($i = $start; $i <= $end; $i++) {
            $pages[] = $i;
        }
        if ($start > 1) {
            $end_min = 1 + $this->options['offset_page'] >= $start ? $start - 1 : 1 + $this->options['offset_page'];
            if ($start - $end_min > 1) {
                array_unshift($pages, null);
            }
            for ($i = $end_min; $i >= 1; $i--) {
                array_unshift($pages, $i);
            }
        }
        if ($items - $end >= 1) {
            if ($items - $this->options['offset_page'] > $end + 1) {
                $pages[] = null;
            }
            $end_max = $items - $this->options['offset_page'] <= $end ? $end + 1 : $items - $this->options['offset_page'];
            for ($i = $end_max; $i <= $items; $i++) {
                $pages[] = $i;
            }
        }

        return $pages;
    }
@param int $current
@param int $items

@return array