protected static function getFilename(string $path): string
    {
        $parts = pathinfo(urldecode($path));
        $path = isset($parts['dirname']) ? $parts['dirname'] : '';
        $filename = isset($parts['basename']) ? $parts['basename'] : '';

        //if has not extension, assume it's a directory and append index.html
        if (empty($parts['extension'])) {
            $filename .= '/index.html';
        }

        return str_replace('//', '/', $path.'/'.$filename);
    }