XF 1.5 How to change number of items in scrollable section of page navigation

as the title suggests, I would like to change the number of items in the scrollable section of the navigation.

So instead of 5 items as shown here

I would like to only show 3.
I changed some css so that it actually shows 3 items, but then the page numbers aren't showing correctly anymore.
It shows it like that then

How can I achieve it, so that it shows the appropriate pages?