private function fetchArticlesFrom(int $pageId, array &$map, int $mainPage): void
    {
        $this->logger->debug('Mapping articles from page ' . $pageId);

        $articles = $this->database->getArticlesByPid($pageId);

        if (empty($articles)) {
            // Skip non regular pages - these are known to not have articles within.
            if (\in_array(
                $pageType = $this->pageMap->getTypeFor($pageId),
                ['error_403', 'error_404', 'forward', 'redirect', 'root']
            )) {
                return;
            }

            $this->logger->notice(
                'Page {id} has no articles.',
                [
                    'id' => $pageId,
                    'pageType' => $pageType,
                    'msg_type' => 'page_no_articles'
                ]
            );
            return;
        }

        // If the language page and main page are same, we do identity mapping.
        if ($pageId === $mainPage) {
            foreach ($articles as $index => $article) {
                $articleId       = (int) $article['id'];
                $map[$articleId] = $articleId;
            }
            return;
        }

        foreach ($articles as $index => $article) {
            $mainId    = (int) $article['languageMain'];
            $articleId = (int) $article['id'];
            if (empty($mainId)) {
                if (0 === ($mainId = $this->determineMapFor($index, $article['inColumn'], $mainPage))) {
                    $this->logger->warning(
                        'Article {id} in page {page} has no fallback set and unable to determine automatically. ' .
                        'Article skipped.',
                        ['id' => $articleId, 'page' => (int) $article['pid'], 'msg_type' => 'article_no_fallback']
                    );
                    continue;
                }

                $this->logger->warning(
                    'Article {id} (index: {index}) has no fallback set, expect problems, I guess it is {guessed}',
                    [
                        'id' => $articleId,
                        'index' => $index,
                        'guessed' => $mainId,
                        'msg_type' => 'article_fallback_guess'
                    ]
                );
            }

            $map[$articleId] = $mainId;
        }
    }