public static function sanitize_filename($i, $allow_subdirs = false, $allowabsolute = false) {
		$i = trim($i);
		$replacements = ['../', './'];
		if ($allow_subdirs === false) {
			$replacements[] = '/';
		}
		if ($allowabsolute !== true && $i{0} === '/') {
			$i = substr($i, 1);
		}
		return str_replace($replacements, '', $i);
	}
public static function sanitize_filename($i, $allow_subdirs = false, $allowabsolute = false) {
		$i = trim($i);
		$replacements = ['../', './'];
		if ($allow_subdirs === false) {
			$replacements[] = '/';
		}
		if ($allowabsolute !== true && $i{0} === '/') {
			$i = substr($i, 1);
		}
		return str_replace($replacements, '', $i);
	}
public static function sanitize_filename ( $ i , $ allow_subdirs = false , $ allowabsolute = false ) { $ i = trim ( $ i ) ; $ replacements = [ '../' , './' ] ; if ( $ allow_subdirs === false ) { $ replacements [ ] = '/' ; } if ( $ allowabsolute !== true && $ i { 0 } === '/' ) { $ i = substr ( $ i , 1 ) ; } return str_replace ( $ replacements , '' , $ i ) ; }
Sanitize a filename.

Specifically, this removes directory traversal via ./ and ../

@param string $i The input value.
@param boolean $allow_subdirs Whether to allow forward directory traversal (i.e. subdirectories).
@return string The sanitized string.
Sanitize a filename .