Better BASE to $_SERVER['DOCUMENT_ROOT'] comparrison

trim($, '/') both, since the ending '/' is optional.