Yes, you should update your script not to use register globals, and turn it off in php.ini. It is really not hard to modify your code, just initialize $pagenum and $tag to the corresponding values contained in the super global $GET: $GET['pagenum'] and $_GET['tag'].
Visit the Register Globals section of the Php manual to learn more on the subject.
Now the main issue you have is that you are running your query:
$result = mysql_query("
SELECT *
FROM `images`
WHERE `tags`
LIKE '%" . mysql_real_escape_string($_GET['tag']) . "%'
ORDER BY views
$max
")
OR die(mysql_error());
before you define $max:
$max = 'limit ' .($pagenum - 1) * $page_rows .',' .$page_rows;
Note how $max is dependent on the value of $page_rows, that means that it needs to be defined before it can be used.
It doesn't really make sense to run the query everytime you hit a page to load the entire content over and over again, it'd be easier to pass it as an array in a hidden field from page to page.