Airship\Cabin\Bridge\Landing\Blog::getOffsetAndLimit PHP 메소드

getOffsetAndLimit() 보호된 메소드

Gets [offset, limit] based on configuration
protected getOffsetAndLimit ( string $page = null, integer $per_page ) : int[]
$page string
$per_page integer
리턴 int[]
    protected function getOffsetAndLimit($page = null, int $per_page = 0)
    {
        if ($per_page === 0) {
            $per_page = (int) ($this->config('blog.per_page') ?? 20);
        }
        $page = (int) (!empty($page) ? $page : $_GET['page'] ?? 0);
        if ($page < 1) {
            $page = 1;
        }
        return [($page - 1) * $per_page, $per_page];
    }