public static function getList($rootPid, $languageId = null)
    {
        $sitemapList = array();
        $pageList    = array();

        $typo3Pids = array();

        $query = 'SELECT ts.*
                    FROM tx_metaseo_sitemap ts
                            INNER JOIN pages p
                              ON    p.uid = ts.page_uid
                                AND p.deleted = 0
                                AND p.hidden = 0
                                AND p.tx_metaseo_is_exclude = 0
                                AND ' . DatabaseUtility::conditionNotIn('p.doktype', self::getDoktypeBlacklist()) . '
                   WHERE ts.page_rootpid = ' . (int)$rootPid . '
                     AND ts.is_blacklisted = 0';

        if ($languageId !== null) {
            $query .= ' AND ts.page_language = ' . (int)$languageId;
        }
        $query .= ' ORDER BY
                        ts.page_depth ASC,
                        p.pid ASC,
                        p.sorting ASC';
        $resultRows = DatabaseUtility::getAll($query);

        if (!$resultRows) {

            return self::getListArray(); //empty
        }

        foreach ($resultRows as $row) {
            $sitemapList[] = $row;

            $sitemapPageId             = $row['page_uid'];
            $typo3Pids[$sitemapPageId] = (int)$sitemapPageId;
        }

        if (!empty($typo3Pids)) {
            $query    = 'SELECT *
                           FROM pages
                          WHERE ' . DatabaseUtility::conditionIn('uid', $typo3Pids);
            $pageList = DatabaseUtility::getAllWithIndex($query, 'uid');

            if (empty($pageList)) {

                return self::getListArray(); //empty
            }
        }

        return self::getListArray($sitemapList, $pageList);
    }