Actually it's viewtopic.php? t=# ,The p parameter is for specific posts.
The f parameter to the best of my knowledge when used in a topic URL is only used to track people for the who is online list as it will show which forum they are in. You can safely remove it for the generated topic URL's by modifying the scripts. Sorry I don't have specific edits and there probably is a few of them.