protected function is_valid_path($path) {
        $rp_substr = substr(realpath($path) . DIRECTORY_SEPARATOR, 0, strlen(realpath($this->path_to_files))) . DIRECTORY_SEPARATOR;
        $rp_files = realpath($this->path_to_files) . DIRECTORY_SEPARATOR;

        // handle better symlinks & network path - issue #448
        $pattern = ['/\\\\+/', '/\/+/'];
        $replacement = ['\\\\', '/'];
        $rp_substr = preg_replace($pattern, $replacement, $rp_substr);
        $rp_files = preg_replace($pattern, $replacement, $rp_files);
        $match = ($rp_substr === $rp_files);

        if (!$match) {
            Log::info('Invalid path "' . $path . '"');
            Log::info('real path: "' . $rp_substr . '"');
            Log::info('path to files: "' . $rp_files . '"');
        }
        return $match;
    }