public function onPagesLoaded(array &$pages)
    {
        unset($pages["403"]);

        if (!$this->config["alterPageArray"]) {
            return;
        }

        // Erase all pages if an error occurred
        if ($this->errorOccurred) {
            $pages = array();
            return;
        }

        foreach ($pages as $id => $page) {
            try {
                $allowed = $this->checkAccess($id);
            } catch (\Exception $e) {
                $this->errorHandler($e, $this->requestUrl);
                $pages = array();
                return;
            }

            if (!$allowed) {
                unset($pages[$id]);
            }
        }
    }