SELECT COUNT(*) FROM `bx_photos_main` as a left JOIN `sys_albums_objects` as b ON b.`id_object`=a.`ID` left JOIN `sys_albums` as c ON c.`ID`=b.`id_album` WHERE a.`Status` ='pending' AND c.`AllowAlbumView` NOT IN(8) AND c.`Type`='bx_photos'