its because people post naked pics or dildos in threads, and then the post gets deleted by a mod. That is what makes ghost pages. The post still kind of exists, so when a new page is made, it still doesn't transger over.
Hard to explain right now for me. Sorry if you don't follwo
Basically if there are 101 posts (3 pages) but someone posts something that gets deleted (now only 100 posts / 2 pages) it should revert to only 2 pages, but the website still recognizes 101 posts and creates the third page, even though you cannot see the post because it was deleted.