sanitize Filename
Sanitizes a filename to prevent directory traversal attacks.
This function:
Extracts the last segment of a path (the actual filename).
Removes any remaining path separators (/ or \).
Removes sequences that could be used for traversal (e.g., ..).
Return
The sanitized filename.