Added helper to generate safe filenames