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];
}