Ensures project paths are valid and secure by removing potentially harmful
characters and preventing directory traversal attempts. This function
sanitizes file paths to prevent security issues and ensure consistent
file naming across different operating systems.