private function sanitize($filename)
    {
        $filename = preg_replace('/[^A-Za-z0-9\-\._]/', '.', (string) $filename);
        return trim(substr(preg_replace('/[_\.\-]{2,}/', '.', $filename), 0, 40), '._-');
    }
private function sanitize($filename)
    {
        $filename = preg_replace('/[^A-Za-z0-9\-\._]/', '.', (string) $filename);
        return trim(substr(preg_replace('/[_\.\-]{2,}/', '.', $filename), 0, 40), '._-');
    }
private function sanitize ( $ filename ) { $ filename = preg_replace ( '/[^A-Za-z0-9\-\._]/' , '.' , ( string ) $ filename ) ; return trim ( substr ( preg_replace ( '/[_\.\-]{2,}/' , '.' , $ filename ) , 0 , 40 ) , '._-' ) ; }
Sanitizes filename.

@param  string $filename The filename
@return string A safe filename
Sanitizes filename .