bug bug bug.
To prevent this from happening in the future, sometimes it makes sense to reverse the conditional, so the static string or integer you're comparing against is first.
e.g.
`if (0 = $total_pages)`
will give a parse error, whereas, this will not:
`if (0 == $total_pages)`

Writing your conditional statements in this way can prevent bugs like this from creeping in.

Make sense?