added conditional checks

This solves:
http://forum.piwik.org/read.php?2,100257

Two conditional checks were added in order to remove
"piwik.php" at the end of the called script only if present.