Include a leading zero in pagination

When your code gets to the point of outputing a number, adjust the number ($pagenumber in this code example) to include leading spaces with a variation on this

$pagenumber = 123;

echo sprintf("%'.09d\n", $pagenumber);

will output

000000123

See the manual: https://www.php.net/manual/en/function.sprintf.php , example 2, and other examples in there.