Split page number parse to separate function.

This is just a purpose, if you like it, I will make unittests for it.

Method name can be changed if you have one better.
The exception type here has changed, and changes the behavior.