Using basename() is not locale safe

Non-US-ASCII characters are stripped out of filenames. PHP's basename() does not properly support streams or filenames beginning with international characters.

example:
filename: "экрана от 2014-04-22 15:15:06.png" (russian, utf8),

basename stip it: "от 2014-04-22 15:15:06.png" (if not set locale by setlocale("ru_RU.UTF-8"))