Basically everything that is not alphanumeric is converted to an underscore and then underscores are condensed. It's for safety and also aesthetics. I found my colleague kept uploading files with difficult names like:
something - something.doc
which ended up like:
something_-_something.doc
but the current clean_filename routine produces:
something_something.doc
which I think is much nicer.
I'm open to discussion about it!

(perhaps in another forum though, like the 'Using Moodle' course ... )