fixed trailing question mark if params contained only null values
fixed edge case with scriptPath containing 'index.php'