My pager looks like

previous 1 | 2 | 3 | 4 next

Previous and next are not active unless you advance to next which puts
page number 2 thru 5. If there are fewer than 4 pages only that number
will show. If there are more than 4 pages next is active and
it scrolls the numbers to always keep 4 page numbers in view with the
current page always marked (class attribute is page_selected) on
selected page.