Fixes #6379: Makes sure that page menu items exist before trying to prepare them for viewing

Allow admin page menu to be altered without causing WSOD. Adds regression test
Fixes #6379