SELECT DISTINCT(id),path,file,date_available
       ,tn_ext,name,filesize,storage_category_id,average_rate
  FROM phpwebgallery_images AS i
    INNER JOIN phpwebgallery_image_category AS ic ON id=ic.image_id
  
    AND  category_id NOT IN (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,28,27,-1)
   ORDER BY hit DESC, file ASC
  LIMIT 30,-15
;
[mysql error 1064] You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-15' at line 8