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.