SELECT DISTINCT(id),path,file,date_available
       ,tn_ext,name,filesize,storage_category_id,average_rate,comment
  FROM phpwebgallery_images AS i
    INNER JOIN phpwebgallery_image_category AS ic ON id=ic.image_id
   WHERE category_id = 49
   ORDER BY date_available DESC, file ASC, id ASC
  LIMIT 0,495
;
[mysql error 145] Table './sarkan01_db1/phpwebgallery_images' is marked as crashed and should be repaired