moved GetNumberOfPages out of testing