Add check to be able to create a top page table

This commit adds a check for top boundary, so if the table
goes up to the top of the document, it will be correctly detected.
Merge pull request #18 from kri5/master

Add check to be able to create a top page table