In a foreach loop, how do I target the last item in the loop?

You can try this :

foreach( $pages as $key => $post )

and :

<div class = "event <?php if( $key == ( count( $pages ) - 1 ) ) echo 'last'; ?>" >

It will add a last class to your last event div.

techhipbettruvabetnorabahisbahis forumutaraftarium24edusedueduseduseduseduedueduseduedu