private function findRootPages(): array
    {
        $result = [
            'source' => null,
            'target' => null,
            'main'   => null,
        ];

        $this->logger->debug(
            'Searching root pages for source "{source}" and target "{target}"',
            ['source' => $this->sourceLanguage, 'target' => $this->targetLanguage]
        );
        foreach ($this->database->getRootPages() as $root) {
            $language = $root['language'];

            if ('1' === $root['fallback']) {
                $this->mainLanguage = $language;
                $result['main']     = (int) $root['id'];
            }

            if ($language === $this->sourceLanguage) {
                $result['source'] = (int) $root['id'];
            }
            if ($language === $this->targetLanguage) {
                $result['target'] = (int) $root['id'];
            }

            // Keep type for being able to filter unknown pages in i.e. articles.
            $this->types[(int) $root['id']] = 'root';
        }

        $this->logger->debug(
            'Found root pages: source: {source}; target: {target}; main: {main}',
            $result
        );

        if (null === $result['source'] || null === $result['target'] || null === $result['main']) {
            throw new \RuntimeException('Not all root pages could be found: ' . var_export($result, true));
        }

        return $result;
    }