PDO automatically escapes data passed to it for queries written like this:
<?php
DB::getInstance()->query("SELECT * FROM %tp%action WHERE controller = ?", CONTROLLER);
?>
If you place the variables in your query yourself (like you show above) then you have to addslashes() it first.
There is some routing, namely:
/[cms]/[controller]/[action]/[REQUEST]
[controller] decides which Controller is loaded (in action/controller.***.php)
[action] decides which method is called on the controller.
[REQUEST] is explode()'d using the / character and the results are passed to the [action] as paramters.
So...
/cms/template/edit/2
will load the TemplateController in actions/controller.template.php, and then call the edit function and pass 2 as the first argument: TemplateController->edit(2);
The arguments passed to the methods are not escaped, that should be done by the code in the function itself (or the db functions).
The only exception is when you call a URL without /cms/ in front of it. Those are all passed to the FrontController, which parses the URL and decides which page should be displayed.