Steps to reproduce
================
1. Create a new empty lesson
2. Add a single page
3. Remove the page
What happens
============
Error message:
Delete: next page not found
Stack trace:
- line 1651 of lib/deprecatedlib.php: call to debugging()
- line 27 of mod/lesson/action/delete.php: call to error()
- line 55 of mod/lesson/lesson.php: call to include()