The current pagination algorithm uses a ranking method for slot width that depends on the number of digits, but is limited to 9 digits (in fact 5 as 10000 is supported which is a bug).
This diff makes it generic so it works with any page number, which in turn fixes the pagination for the testnet explorer blocks page (>15000 pages).
It involves a log10 computation instead of the branching selection. Because of javascript I have no idea if this performs better or worse than the previous version but it's a single computation per page so the impact is negligible anyway.