select activityev0_.ase_eventid as ase1_33_, activityev0_.ase_requestid as ase2_33_, activityev0_.ase_stream as ase3_33_, activityev0_.ase_date as ase4_33_, activityev0_.ase_priority as ase5_33_, activityev0_.ase_type as ase6_33_, activityev0_.ase_application as ase7_33_, activityev0_.ase_user as ase8_33_, activityev0_.ase_wiki as ase9_33_, activityev0_.ase_space as ase10_33_, activityev0_.ase_page as ase11_33_, activityev0_.ase_hidden as ase12_33_, activityev0_.ase_url as ase13_33_, activityev0_.ase_title as ase14_33_, activityev0_.ase_body as ase15_33_, activityev0_.ase_version as ase16_33_, activityev0_.ase_param1 as ase17_33_, activityev0_.ase_param2 as ase18_33_, activityev0_.ase_param3 as ase19_33_, activityev0_.ase_param4 as ase20_33_, activityev0_.ase_param5 as ase21_33_ from activitystream_events activityev0_ where (activityev0_.ase_type=? and activityev0_.ase_date>=? and (activityev0_.ase_wiki=? and activityev0_.ase_page=?
or activityev0_.ase_wiki=? and activityev0_.ase_page=?
or activityev0_.ase_type=? and activityev0_.ase_date>=?
and (activityev0_.ase_wiki=? and activityev0_.ase_page=?
or activityev0_.ase_wiki=? and activityev0_.ase_page=?
or activityev0_.ase_wiki=? and activityev0_.ase_page=?)
or activityev0_.ase_type=? and activityev0_.ase_date>=? and (activityev0_.ase_wiki=? and activityev0_.ase_page=?
or activityev0_.ase_wiki=? and activityev0_.ase_page=?
or activityev0_.ase_wiki=? and activityev0_.ase_page=?)
or activityev0_.ase_type=? and activityev0_.ase_date>=? and (activityev0_.ase_wiki=? and activityev0_.ase_page=?
or activityev0_.ase_wiki=? and activityev0_.ase_page=?
or activityev0_.ase_wiki=? and activityev0_.ase_page=?)) and (activityev0_.ase_type<>?
or activityev0_.ase_version like concat(‘%’, ?) escape ‘!’) and activityev0_.ase_user<>? and activityev0_.ase_user<>? and (activityev0_.ase_eventid not in (select activityev1_.ases_eventid from activitystream_events_status activityev1_, activitystream_events activityev2_ where activityev1_.ases_eventid=activityev2_.ase_eventid and activityev1_.ases_eventid=activityev0_.ase_eventid and activityev1_.ases_entityid=? and activityev1_.ases_read=1)) and (activityev0_.ase_eventid not in (? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ?)) and activityev0_.ase_hidden<>1
order by activityev0_.ase_date DESC limit ?