public static function getAccessRootlineByPageId(
        $pageId,
        $mountPointParameter = ''
    ) {
        $accessRootline = GeneralUtility::makeInstance(Rootline::class);

        $pageSelector = GeneralUtility::makeInstance(PageRepository::class);
        $pageSelector->init(false);
        $rootline = $pageSelector->getRootLine($pageId, $mountPointParameter);
        $rootline = array_reverse($rootline);
        // parent pages
        foreach ($rootline as $pageRecord) {
            if ($pageRecord['fe_group']
                && $pageRecord['extendToSubpages']
                && $pageRecord['uid'] != $pageId
            ) {
                $accessRootline->push(GeneralUtility::makeInstance(
                    RootlineElement::class,
                    /** @scrutinizer ignore-type */ $pageRecord['uid'] . RootlineElement::PAGE_ID_GROUP_DELIMITER . $pageRecord['fe_group']
                ));
            }
        }

        // current page
        $currentPageRecord = $pageSelector->getPage($pageId);
        if ($currentPageRecord['fe_group']) {
            $accessRootline->push(GeneralUtility::makeInstance(
                RootlineElement::class,
                /** @scrutinizer ignore-type */ $currentPageRecord['uid'] . RootlineElement::PAGE_ID_GROUP_DELIMITER . $currentPageRecord['fe_group']
            ));
        }

        return $accessRootline;
    }