theme: work around oddball edge cases

I'm not entirely sure how this is triggered, but report pages in Totara
seem to screw with the ordinary page load process. Maybe it's pagelayout
related?