How to align a long title in a table of content so that it won't be over page numbers

This is possible. You have to manually edit the indentation and tab rules for the TOC style that you want to modify.

  1. Open the Styles pane.
  2. Right-click the style that you want to modify.
  3. Click Modify...
  4. Click the Format >> Paragraph...
  5. In the Indentation section change the Right indentation level to the position where you want the text to wrap to the next line.
  6. Click the Tabs... button.
  7. Enter a tab stop at the position where you want the page number to be right-aligned (past the indentation position that you just set).
  8. Set the Alignment to right.
  9. Set the desired Leader character. (optional)
  10. Click Add.
  11. You may need to remove the previous tab position by selecting it from the list and clicking Clear.
  12. Click OK.