Are there any potential pitfalls when using $HTTP_SERVER_VARS['DOCUMENT_ROOT'] and $HTTP_SERVER_VARS['REQUEST_URI'] to determine the path?
Using $HTTP_SERVER_VARS['DOCUMENT_ROOT'] and $HTTP_SERVER_VARS['REQUEST_URI'] can be risky because they are not guaranteed to be available in all server configurations, and they can be manipulated by malicious users. It's recommended to use the more reliable $_SERVER['DOCUMENT_ROOT'] and $_SERVER['REQUEST_URI'] instead to determine the path.
$document_root = isset($_SERVER['DOCUMENT_ROOT']) ? $_SERVER['DOCUMENT_ROOT'] : '';
$request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';