What considerations should be taken into account when using basename() function in PHP for file manipulation?

When using the `basename()` function in PHP for file manipulation, it is important to consider the possibility of directory traversal attacks. To prevent this, always sanitize user input and ensure that the input passed to `basename()` is a safe and valid file path. Additionally, consider using other functions or methods to validate and sanitize file paths before using `basename()`.

// Example of using basename() with sanitized input
$unsafe_filename = $_GET['filename']; // Unsafe input from user
$safe_filename = basename($unsafe_filename); // Sanitize input before using basename()