public function getPageCanonicalURL($page, $querystring = null)
    {
        $result = null;
        if ($page) {
            if ($this->valn->integer($page, 1)) {
                $page = Page::getByID($page);
            }
            if ($page instanceof Page && !$page->isError()) {
                $cID = $page->getCollectionID();
                $originalCID = $page->getCollectionPointerOriginalID();
                if (!empty($originalCID) && $originalCID != $cID) {
                    $result = $this->getPageCanonicalURL($cID, $querystring);
                } else {
                    $result = $this->resolver->resolve([$page]);
                    $query = null;
                    if ($querystring instanceof Query) {
                        $query = clone $querystring;
                    } elseif ($querystring instanceof Request) {
                        $query = new Query($querystring->query->all());
                    } elseif ($querystring instanceof ParameterBag) {
                        $query = new Query($querystring->all());
                    } elseif (is_array($querystring)) {
                        $query = new Query($querystring);
                    } elseif (is_string($querystring)) {
                        if ($querystring !== '') {
                            $query = new Query($querystring);
                        }
                    }
                    if ($query !== null && $query->count() > 0) {
                        foreach ($this->excludedQuerystringParameters as $qp) {
                            $query->offsetUnset($qp);
                        }
                        $result = $result->setQuery($query);
                    }
                }
            }
        }

        return $result;
    }