private function extractFilename(\ZipArchive $zipArchive, $fileIndex)
    {
        $entry = $zipArchive->statIndex($fileIndex);

        // convert Windows directory separator to Unix style
        $filename  = str_replace('\\', '/', $entry['name']);

        if ($this->isValidPath($filename)) {
            return $filename;
        }

        throw new \Exception('Invalid filename path in zip archive');
    }