In cases where the cgi is called called by a handler and not directly in the url fossil generates ugly links. you can see an example of this at suggest using REQUEST_URI rather than SCRIPT_NAME