in reply to auto cutting or setting page size limite per lines etc

This assumes that the list doesn't change frequently, or if it does you don't care about the occasional bad link or miss. Pseudocode:
Get the list of files in @list
Set the maximum number per page in $max
Determine from the CGI param "page", which page we're
     supposed to display.  Default to 0 if not set.
Divide the list by $max, round up.  Save this in $chunk.
Take the section of @list from $max*$page to
    ($max*($page+1)-1) or the end, whichever.
Display the list of things from the previous step.
At the end of the page, make links back to this script 
    for each of 0 to $chunk.  Bake page=$chunk into each
    of the link urls.  These will display various pages
    of the list.