Implement isValidFilenameImpl

I've implemented it exactly like the C native.
This is another of the things that are overly logged in the console.