Add function to count redirects