VID-1841 Make sure cat names use underscores

You could speed it up even more and save some memory if you modify the reference, instead of creating new array.
So foreach ( $categories as &$category ) { ... }