Counts rows for specified site

@param int $rootPageId
@return int
489502
public function countByRootPageId(int $rootPageId): int
    {
        $queryBuilder = $this->getQueryBuilder();
        return (int)$this->getQueryBuilder()
            ->count('*')
            ->from($this->table)
            ->andWhere($queryBuilder->expr()->eq('root_pid', $rootPageId))
            ->execute()->fetchColumn(0);
    }
366053
protected function getDefaultLanguage($rootPageId)
    {
        $siteDefaultLanguage = 0;

        $configuration = Util::getConfigurationFromPageId($rootPageId, 'config');

        $siteDefaultLanguage = $configuration->getValueByPathOrDefaultValue('sys_language_uid', $siteDefaultLanguage);
        // default language is set through default L GET parameter -> overruling config.sys_language_uid
        $siteDefaultLanguage = $configuration->getValueByPathOrDefaultValue('defaultGetVars.L', $siteDefaultLanguage);

        return $siteDefaultLanguage;
    }
1071196
public function updateConnectionByRootPageId($rootPageId)
    {
        $systemLanguages = $this->systemLanguageRepository->findSystemLanguages();
        $siteRepository = GeneralUtility::makeInstance(SiteRepository::class);
        $site = $siteRepository->getSiteByRootPageId($rootPageId);
        $rootPage = $site->getRootPage();

        $updatedSolrConnections = [];
        foreach ($systemLanguages as $languageId) {
            $connection = $this->getConfiguredSolrConnectionByRootPage($rootPage, $languageId);

            if (!empty($connection)) {
                $updatedSolrConnections[$connection['connectionKey']] = $connection;
            }
        }

        $solrConnections = $this->getAllConfigurations();
        $solrConnections = array_merge($solrConnections, $updatedSolrConnections);
        $solrConnections = $this->filterDuplicateConnections($solrConnections);
        $this->setAllConfigurations($solrConnections);
    }
55213
public function buildPagesResourceId(
        $siteId
    ) {
        return $this->resourceName->get(
            ResourceName::RESOURCE_SITES,
            $siteId,
            ResourceName::RESOURCE_PAGES
        );
    }
160787
private function getSubPagesRecursive($rootPageId)
    {
        $pages = $this->getSubPages($rootPageId);
        foreach ($pages as $page) {
            if (false === $this->isPageTreeLeaf($page)) {
                ArrayUtility::mergeRecursiveWithOverrule(
                    $pages,
                    $this->getSubPagesRecursive($page['uid'])
                );
            }
        }

        return $pages;
    }
1009116
public function getIsRootPageId($pageId)
    {
        // Page 0 can never be a root page
        if ($pageId === 0) {
            return false;
        }

        // Page -1 is a workspace thing
        if ($pageId === -1) {
            return false;
        }

        $cacheId = 'RootPageResolver' . '_' . 'getIsRootPageId' . '_' . $pageId;
        $isSiteRoot = $this->runtimeCache->get($cacheId);

        if (!empty($isSiteRoot)) {
            return $isSiteRoot;
        }

        $page = $this->getPageRecordByPageId($pageId);
        if (empty($page)) {
            throw new \InvalidArgumentException(
                'The page for the given page ID \'' . $pageId
                . '\' could not be found in the database and can therefore not be used as site root page.',
                1487171426
            );
        }

        $isSiteRoot = Site::isRootPage($page);
        $this->runtimeCache->set($cacheId, $isSiteRoot);

        return $isSiteRoot;
    }
474567
public function getActivePageThemeForSite($pageId, $themeId, $siteId = null, $mode = AbstractQuery::HYDRATE_OBJECT)
    {
        /** @var $query \Doctrine\ORM\QueryBuilder */
        try {
            $qb     = $this->getEntityManager()->createQueryBuilder();
            $params = [
                ':pageId'      => $pageId,
                ':active'      => 1,
                ':siteThemeId' => $themeId,
            ];
            $query  = $qb->select('e, p, t')
                ->from($this->getEntity(), 'e')
                ->innerJoin('e.template', 't')
                ->innerJoin('t.theme', 'th')
                ->innerJoin('e.page', 'p')
                ->where('e.page = :pageId')
                ->setParameters($params);

            if (is_numeric($themeId)) {
                $query->andWhere('t.theme = :siteThemeId');
            } else {
                $query->andWhere('th.slug = :siteThemeId');
            }

            $query->andWhere('e.isActive = :active');

            if ($siteId) {
                //$this->disableSiteFilter();
                $query->andWhere($query->expr()->eq('e.site', $siteId));
            }

            $query->setMaxResults(1);
            $result = $query->getQuery()->getOneOrNullResult($mode);

            return $result;
        } catch (\Exception $exception) {
            $this->getLogger()->logException($exception);

            return null;
        }
    }
1298981
public function findAllByRoot( $rootId  = null,
                                   $order   = null,
                                   $limit   = null,
                                   $offset  = null )
    {
        $select = $this->select();

        if ( empty( $rootId ) )
        {
            $where = array(
                new Predicate\IsNull( 'rootParagraphId' )
            );
        }
        else
        {
            $where = array(
                'rootParagraphId' => (int) $rootId,
            );
        }

        $select->where( $where )
               ->order( $order ?: array() )
               ->limit( $limit )
               ->offset( $offset );

        /* @var $result \Zend\Db\Adapter\Driver\ResultInterface */

        $return = array();
        $result = $this->sql()
                       ->prepareStatementForSqlObject( $select )
                       ->execute();

        foreach ( $result as $row )
        {
            $return[] = $this->selected( $row );
        }

        return $return;
    }
1317738
public function getLastIndexedItemId($rootPageId)
    {
        $lastIndexedItemId = 0;

        $lastIndexedItemRow = $this->queueItemRepository->findLastIndexedRow($rootPageId);
        if ($lastIndexedItemRow[0]['uid']) {
            $lastIndexedItemId = $lastIndexedItemRow[0]['uid'];
        }

        return $lastIndexedItemId;
    }
335924
public function countFilterBySiteIds(array $siteIds)
    {
        $qa = $this->createAggregationQuery();
        $qa->match($this->getReferenceFilter('groups', $this->generateFilterSiteId($siteIds)));

        return $this->countDocumentAggregateQuery($qa);
    }
887216
public function getMaxPosition(int $pageId): int
	{
		return $this->connection->query('SELECT IFNULL(MAX([position]), 0) position FROM %table WHERE [pageId] = %i', $this->getTableName(), $pageId)->fetch()->position;
	}
269075
public static function getChildPagesCount($page_id = null)
    {
        if (is_null($page_id)) {
            return null;
        }

        $children = PageManager::fetch(false, array('id'), array(
            sprintf('parent = %d', $page_id)
        ));
        $count = count($children);

        if ($count > 0) {
            foreach ($children as $c) {
                $count += self::getChildPagesCount($c['id']);
            }
        }

        return $count;
    }
380159
function roleCount($UserID = null)
	{
		if ($UserID === null)
		    throw new \RbacUserNotProvidedException ("\$UserID is a required argument.");

		$Res = Jf::sql ( "SELECT COUNT(*) AS Result FROM {$this->tablePrefix()}userroles WHERE UserID=?", $UserID );
		return (int)$Res [0] ['Result'];
	}
242953
public static function getChildPageIds($pageId)
    {
        if (empty(self::$preloaded_page_children)) {
            foreach (static::preloadArray() as $key => $page) {
                if (!isset(self::$preloaded_page_children[$page->parent])) {
                    self::$preloaded_page_children[$page->parent] = [];
                }
                self::$preloaded_page_children[$page->parent][] = $page->id;
            }
        }
        return !empty(self::$preloaded_page_children[$pageId]) ? self::$preloaded_page_children[$pageId] : [];
    }
223727
public function findPageById($pageId)
    {
        $this->makeCollectionPageSelect(true);
        $this->sql .= ' and p.id = ?';
        $this->bindValues[] = $pageId;

        return $this->findRow();
    }
1272482
protected function buildPageIdRootline($pageId, $mountPoint = '')
    {
        $rootlinePageIds = [];

            /** @var $pageSelector PageRepository */
        $pageSelector = GeneralUtility::makeInstance(PageRepository::class);
        $rootline = $pageSelector->getRootLine($pageId, (string)$mountPoint);

        foreach ($rootline as $page) {
            if (Site::isRootPage($page)) {
                break;
            }

            array_unshift($rootlinePageIds, $page['pid']);
        }

        $rootlinePageIds[] = $pageId;

        return $rootlinePageIds;
    }
1200667
public function getSearchStatistics(int $rootPageId, int $days = 30, $limit = 10)
    {
        $now = time();
        $timeStart = (int)($now - 86400 * $days); // 86400 seconds/day
        $limit = (int)$limit;

        return $this->getPreparedQueryBuilderForSearchStatisticsAndTopKeywords($rootPageId, $timeStart, $limit)
            ->execute()->fetchAll();
    }