$path = substr($path, 0, rindex($path, "/", ($_ = rindex($path, "?")) != -1 ? $_ : length($path)) + 1);