Смотрите функцию fn_generate_pagination https://skr.sh/sGFEoqzMJUL
в файле app/functions/fn.common.php
$pagination = array (
'navi_pages' => range($page_from, $page_to),
'prev_range' => ($page_from > 1) ? $page_from - 1 : 0,
'next_range' => ($page_to < $total_pages) ? $page_to + 1: 0,
'current_page' => $params['page'],
'prev_page' => ($params['page'] > 1) ? $params['page'] - 1 : 0,
'next_page' => ($params['page'] < $total_pages) ? $params['page'] + 1 : 0,
'total_pages' => $total_pages,
'total_items' => $params['total_items'],
'items_per_page' => $params['items_per_page'],
'per_page_range' => array(10, 25, 50, 100, 250),
'range_from' => (($params['page'] - 1) * $params['items_per_page']) + 1,
'range_to' => (($params['page'] * $params['items_per_page']) > $params['total_items']) ? $params['total_items'] : $params['page'] * $params['items_per_page'],
);