Add missing null checks to prevent crashes on page changes

Added missing null checks in docs_module_begin to avoid issues with page...s that are missing documentation.

This is an issue if no index is supplied since it will cause docular to crash on changing categories.
Simplified page already loaded logic and added a missing null check there.
This is an enhancement of pull request #85 without the windows compatibility fix.