Fix #881, find_all() time to handle 5000+ records

Since $return should not change in length within the foreach loop that
calls trigger(), we should not need to count it on every iteration of
the loop. Storing the count($return) - 1 in $last_record before entering
the loop, then comparing $key == $last_record inside the loop returned
the processing of 5,000-15,000 records to an acceptable duration.
- It may be a good idea to test with larger datasets, but at some point
we can assume that working with large amounts of data may require less
abstraction from the database (or a leaner, specialized method).