If any third-party app thing for some reason relies on the pages div existing but being empty (no pages), please alter your detection so it is equally happy if the pages div is not there to begin with.
Likewise if it relies on the top/bottom pages div classes; those are most likely going to go. It'll just have the class "pages".
— astral