If your path has a query string appended, and if the query string contains a "/" character, then the suggestions for extracting the filename offered below don't work ...
php.net