protected function formatPath(string $path, int $line): string
    {
        $path = $this->escapeHtml($path);
        $file = preg_match('#[^/\\\\]*$#', $path, $file)
            ? $file[0]
            : $path;

        if ($linkFormat = $this->fileLinkFormat) {
            $link = strtr(
                $this->escapeHtml($linkFormat),
                ['%f' => $path, '%l' => $line]
            );

            return sprintf(
                ' in <a href="%s" title="Go to source">%s line %d</a>',
                $link,
                $file,
                $line
            );
        }

        return sprintf(
            ' in <a title="%s line %3$d" ondblclick="let f=this.innerHTML;this.innerHTML=this.title;this.title=f;">%s line %d</a>',
            $path,
            $file,
            $line
        );
    }