Navigation is not properly built when the navigation container is not a direct child of the page container.

When the total number of pages is calculated, the code looks for the navigation container to be a direct child of the page container. I changed it to look at anything contained in the page container's DOM (children, grandchildren, etc.).