Fix page number code.

Fixes bug from 04fa72aed9eba7658966bb242e0136794d1e611b.